package com.scheduling.order.entity.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单数据传输对象
 *
 * @author 开发团队
 * @since 2025-05-29
 */
@Data
@Schema(description = "订单信息")
public class OrderDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "订单ID")
    private String orderId;

    @Schema(description = "客户ID")
    private String customerId;

    @Schema(description = "客户名称", required = true)
    @NotBlank(message = "客户名称不能为空")
    private String customerName;

    @Schema(description = "客户联系方式", required = true)
    @NotBlank(message = "客户联系方式不能为空")
    private String customerContact;

    @Schema(description = "截止日期", required = true)
    @NotNull(message = "截止日期不能为空")
    private LocalDate dueDate;

    @Schema(description = "订单状态")
    private String status;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    @Schema(description = "订单项列表", required = true)
    @NotEmpty(message = "订单项不能为空")
    @Valid
    private List<OrderItemDTO> orderItems;

    @Schema(description = "订单总数量")
    private Integer totalQuantity;

    @Schema(description = "已完成数量")
    private Integer completedQuantity;

    @Schema(description = "完成率")
    private Double completionRate;
} 